//
//  CustomView.m
//  srcollView_demo
//
//  Created by SunChao on 17/8/25.
//  Copyright © 2017年 SunChao. All rights reserved.
//
#define RGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define BottomEdge 40
#define Spacing 10
#import "QCustomView.h"

@implementation QCustomView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        int imgW = self.frame.size.width/2;
        int imgX = (self.frame.size.width-imgW)/2;
        int imgY = (self.frame.size.height-imgW)/2;
        _cImgView = [[UIImageView alloc] initWithFrame:CGRectMake(imgX, imgY, imgW, imgW)];
        
        [self addSubview:_cImgView];
        
        _cButton = [[UIButton alloc] initWithFrame:self.bounds];
        _cButton.backgroundColor = [UIColor clearColor];
        [self addSubview:_cButton];
        float centerY = _cImgView.centerY;
        _cLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, centerY+imgW/2, CGRectGetWidth(frame), 15)];
        [self addSubview:_cLabel];
    }
    return self;
}

@end
